//  order_by //综合排序 1综合排序，2距离最近，3补贴最高，4名额最多
// 	type//筛选饿了么或美团 1是美团2是饿了么
// 	lat //经纬度
// 	lng//经纬度
// 	is_orderable//做个开关 是否显示有商家 haveOrder: this.haveOrder == 1 ? 0 : 1,
// 	page
// 	limit


import {lsHttp} from "../utils/lshttp";

// 获取店铺列表
export const getShopListAPI = (data) => {
    return lsHttp({
        url: '/api/shop/lists',
        method: 'POST',
        data: data,
    }, false)
}
// 获取店铺列表 + 美团馆返
export const getNewShopListAPI = (data) => {
    return lsHttp({
        url: '/api/shop/mt_list',
        method: 'POST',
        data: data,
    }, false)
}
// wx api 注册
export const jssdk = () => {
    return lsHttp({
        url: '/api/wechat/jssdk',
        method: 'POST',
        data: {
            url: encodeURIComponent(window.location.href.split('#')[0])
        },
    }, false)
}

export const getGFShopListAPI = (data) => {
    return lsHttp({
        url: '/api/mtShop/getShopList',
        method: 'POST',
        data: data,
    }, false)
}
// 获取菜单
// client： app h5 applet
export const getMenuListAPI = (client = 'h5') => {
    return lsHttp({
        url: '/api/nav/reward',
        method: 'POST',
        data: {
            "group": 1,
            "client": 'h5'
        }
    }, {isHideLoading: false})
}

// 获取banner
export const getBannerListAPI = (data = {}) => {
    return lsHttp({
        url: '/api/nav/banner',
        method: 'POST',
        data
    }, false)
}

// 弹窗列表
export const getPopupListAPI = () => {
    return lsHttp({
        url: '/api/popup/lists',
        method: 'POST',
    }, false)
}

// 埋点数据接口
export const getEventTrackingAPI = (data) => {
    return lsHttp({
        url: '/api/EventTracking/addLog',
        method: 'POST',
        data: data
    }, false)
}

// 通知公告列表
export const getNoticeListAPI = () => {
    return lsHttp({
        url: '/api/notice/lists',
        method: 'POST',
    }, false)
}
// 通知公告已阅读
export const dealReadAPI = (id) => {
    return lsHttp({
        url: '/api/notice/dealRead',
        method: 'POST',
        data: {id}
    }, false)
}

// 店铺入住
export const goodShopAPI = (data) => {
    return lsHttp({
        url: '/api/common/settleIn',
        method: 'POST',
        data: data
    })
}

// 系统消息
export const getNoticeAPI = (data) => {
    return lsHttp({
        url: '/api/notice/lists',
        method: 'POST',
        data: data
    })
}

// 商务合作
export const cooperateAPI = (data) => {
    return lsHttp({
        url: '/api/common/cooperate',
        method: 'POST',
        data: data
    })
}

// 优质店铺
export const goodShopsAPI = () => {
    return lsHttp({
        url: '/api/shop/goodShop',
        method: 'POST',
    })
}

// 获取首页banner导航
export const getBannerNavAPI = (group) => {
    return lsHttp({
        url: '/api/nav/menu_reward',
        method: 'POST',
        data: {
            "group": group
        }
    }, false)
}
// 获取首页导航
export const getHomeNavAPI = (group) => {
    return lsHttp({
        url: '/api/nav/app_menu_reward',
        method: 'POST',
    }, false)
}
// 获取首页导航
export const placeUploadAPI = (group) => {
    return lsHttp({
        url: '/api/user/placeUpload',
        method: 'POST',
    }, false)
}

// type 金币类型：5团长分享 6完成新人教程
export const addGoldCoinAPI = (type) => {
    return lsHttp({
        url: '/api/signIn/addGoldCoin',
        method: 'POST',
        data: {type}
    })
}
// 获取用户是否领取过金币接口
export const getCollectionDetailsAPI = () => {
    return lsHttp({
        url: '/api/signIn/getCollectionDetails',
        method: 'POST',
        data: {}
    })
}

// 兑换专区
export const goldRedeemAPI = (type) => {
    return lsHttp({
        url: '/api/goldRedeem/lists',
        method: 'POST',
        data: {type}
    },false)
}

// 商品兑换
export const redeemAPI = (id) => {
    return lsHttp({
        url: '/api/goldRedeem/redeem',
        method: 'POST',
        data: {id}
    })
}

// 天天折扣
export const navTtzkAPI = () => {
    return lsHttp({
        url: '/api/nav/index',
        method: 'POST'
    },false)
}
// 广告平台接口
export const getAdCallBackAPI = (data) => {
    return lsHttp({
        url: '/api/home/adCallBack',
        method: 'POST',
        data: data
    }, false)
}

// 定位
export const locationAPI = async () => {
    const res = await uni.getSystemInfo()
    console.log('getWifiList', res)
    uni.getDeviceInfo()
    let currentTimeStamp = Date.now()
    uni.request({
        method: 'POST',
        url: 'https://api.newayz.com/location/hub/v1/track_points?access_key=PITF1fWFopj2mcK0Pbnt9SNWBrb1G5c1&response_sprf=gcj02',
        data: {
            "timestamp": currentTimeStamp,
            "id": "390928a0-06d4-11e9-a952-024c",
            "asset": {
                "id": "390928a0-06d4-11e9-a952-024cxxxxxxxx",
                "manufacturer": "xiaomi",
                "model": "Note",
                "imeiMd5": "234567890",
                "macAddress": "1a:2b:3c:4d:5e:6f",
                "serialNumber": "xxxxxxxx",
                "uniqueId": "xxxxxxxx",
                "os": {
                    "type": "Android",
                    "version": "MI UI 9.6"
                }
            }, "location": {
                "timestamp": 1515743846504,
                "gnss": { // 如果未采集到，则省略当前字段，下同"timestamp": 1515743846504, "point": {
                    "longitude": 116.248634,
                    "latitude": 36.334663,
                    "altitude": 34.54
                }, "accuracy": 25,
                "velocity": 3.2,
                "heading": 0
            }, "cellulars": [{
                "timestamp": 1515743846504,
                "cellId": 12338443,
                "connected": true,
                "signalStrength": 97,
                "radioType": "lte",
                "mobileCountryCode": 460,
                "mobileNetworkCode": 1,
                "locationAreaCode": 6380
            }, {
                "timestamp": 1515743846504,
                "cellId": 12338443,
                "signalStrength": 97,
                "radioType": "lte",
                "mobileCountryCode": 460,
                "mobileNetworkCode": 1,
                "locationAreaCode": 6380
            }
            ], "wifis": [{
                "signalStrength": 43,
                "macAddress": "88:25:93:6f:df:bb",
                "connected": true
            },
                {"signalStrength": 43, "macAddress": "94:77:2b:65:1a:00"},
                {"signalStrength": 57, "macAddress": "88:25:93:6f:df:ba"},
                {"signalStrength": 60, "macAddress": "94:77:2b:65:1a:04"},
                {"signalStrength": 60, "macAddress": "d4:68:ba:03:34:b8"},
                {"signalStrength": 70, "macAddress": "a8:0c:ca:81:76:86"},
                {"signalStrength": 70, "macAddress": "a8:0c:ca:89:76:86"},
                {"signalStrength": 71, "macAddress": "a8:0c:ca:99:76:86"},
                {"signalStrength": 71, "macAddress": "a8:0c:ca:91:76:86"},
                {"signalStrength": 71, "macAddress": "a8:0c:ca:91:76:86"}
            ]
        },
        success: (res) => {
            console.log(res.data);
        }
    })
}